{extend name="wap/b2c/base" /}
{block name="resources"}
<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/control_type.css">
<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/goods_list.css">
<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/group_buy.css">
<style type="text/css">
.custom-search-button{top: 1px;}
.sliding {overflow-y: auto;background: #ffffff;}
.sliding::-webkit-scrollbar {display: none;}
.sliding ul {white-space: nowrap;text-align: center;}
.sliding ul li {padding: 10px 10px 0 10px;display: inline-block;background: #ffffff;border-right: 2px solid #f8f8f8;width:25%;}
.sliding ul li img{width:60px;height:60px;}
.members_goodspic{border-bottom:1px solid #f3f3f3;}
.info p.goods-title{padding-top:10px;}
.info p.goods-price{margin:0;margin-bottom:8px;}
.controltype{height:35px;margin:0;width:100%;line-height:32.5px;}
.controltype>.control_l_content{top:0;background: none;}
.info p.goods-price>em{font-size:12px;font-weight:bold;color:#f23030;}
.popup{
	    background: none;
		padding:0;
}
.code{
	
    width: 60%;
    margin: 0 auto;
    background: #fff;
    border-radius: 13px;
}
</style>
{/block}

{block name="goodsHead"}
<!-- 标识：是否显示顶部关注  0：[隐藏]，1：[显示]-->
{if condition="$is_subscribe == 1"}
<div class="fixed-focus-on">
	<i class="close" onclick="$('.fixed-focus-on').hide();">x</i>
	<div class="foucs-on-block">
		{if condition="$source_img_url != ''"}
		<img class="user-bg" src="__UPLOAD__/{$source_img_url}">
		{else/}
		<img class="user-bg" src="__TEMP__/{$style}/public/images/default/default_shop_avatar.png">
		{/if}
		{if condition="$source_user_name != ''"}
		<p>我是你的好友<span>{$source_user_name}</span>,推荐给您让生意从此做好</p>
		{else/}
		<p>您当前还未关注微信公众账号，请点击关注</p>
		{/if}
		<button id="subscribe">点击关注</button>
	</div>
</div>
{/if}


<!-- 遮罩层 -->
	<div class="shade" style="position:fixed;top:0px;left:0px;width:100%;height:100%;margin-top:0;background: rgba(0, 0, 0, 0.7);z-index: 999;display:none;"><span style="float: right; padding: 15px;font-size: 22px;color: #fff;background: transparent;" id="close">X</span></div>
<!-- 弹出层 --> 
	<div class="popup" style="position:fixed;top: 36%;left: 0px;width: 100%;height: 100%;margin-left:0px;display:none;">
		
		<div class="code">
			<div style="overflow: hidden;">
			   <img src="__ROOT__/{$web_info.web_qrcode}"  style="max-width: 100%;margin-top: 10px;"/>
			   <div style="color:#666; margin-bottom: 10px;">长按二维码关注公众微信</div>
			</div>
		</div>
	</div>



{/block}

{block name="main" }
{include file='wap/b2c/share'/}

<div class="com-content">

<!-- 搜索 -->
<div style="width: 100%;background-color: #fff;padding: 10px 0px;">
	{include file='wap/b2c/Index/controlSearch'/}
	<style>.custom-search-button{top:0;}</style>
</div>
<!-- 轮播图 -->
{include file='wap/b2c/Index/controlSlide'/}

<!-- 公告 -->
{include file='wap/b2c/Index/controlNotice' /}
<!-- 导航 -->
{include file='wap/b2c/Index/controlNav'/}




<!-- 品牌专区 -->


<!-- 限时折扣 -->


<!-- 促销模块 -->
{foreach name="class_list" item="class"}
	{if $class.class_name=='新品上市'}
	<div class="controltype">
		<!-- <img src="__TEMP__/{$style}/public/images/newproduct.png"/> -->
		<!-- <span class="control_l_content" style="color:#FF4449;">{$class.class_name}</span> -->
		<img src="__TEMP__/{$style}/public/images/navimg/new_arrival.png">
	</div>
	<section class="members_goodspic">
		<ul>
			{foreach name="class.goods_list" item="goods" key = "k"}
			{if condition="$k<4" }
				{if condition="$k%2==0"}
				<li class="gooditem" style="margin-bottom:1px;margin-left:0;margin-top:0;margin-right:0;border-right:1px solid #F3F3F3;width:49%;height:80px;padding:10px 0;" onclick='location.href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"'>
				{else/}
				<li class="gooditem" style="margin-bottom:1px;margin-left:0;margin-top:0;margin-right:0;width:50%;height:80px;padding:10px 0;" onclick='location.href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"'>
				{/if}
				<div class="img" style="float:right;width:50%;height: initial;">
					<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}">
						<img class="lazy" src="__UPLOAD__/{$goods.picture_info.pic_cover_small}" style="width: 80px;">
				</a>
				</div>
				<div class="info">
					<p class="goods-title"><a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}">{$goods.goods_info.goods_name}</a></p>
					<p class="goods-price"><em>￥{$goods.goods_info.promotion_price}</em></p>
					
				</div>
			</li>
			{/if}
			{/foreach}
		</ul>
	</section>
	<div class="sliding">
		<ul id="slider">
			{foreach name="class.goods_list" item="goods" key = "k"}
			<li>
				<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}">
					<img class="lazy" src="__UPLOAD__/{$goods.picture_info.pic_cover_small}" >
				</a>
				<p class="goods-title" style="width:95px;overflow:hidden;"><a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}">{$goods.goods_info.goods_name}</a></p>
				<p class="goods-price"><em style="color:red;font-size:12px;font-weight:bold;">￥{$goods.goods_info.promotion_price}</em></p>
			</li>
			{/foreach}
		</ul>
	</div>
	{/if}
	
{/foreach}
<!-- 限时折扣 -->
{if condition="count($discount_list) >0"}
{include file='wap/b2c/Index/controlDiscount'/}
{/if}

{foreach name="class_list" item="class"}
	{if $class.class_name=='热销排行'}
	<div class="controltype">
		<!-- <img src="__TEMP__/{$style}/public/images/hotsale.png"/> -->
		<!-- <span class="control_l_content" style="color:green;">{$class.class_name}</span> -->
		<img src="__TEMP__/{$style}/public/images/navimg/top_selling.png">
	</div>
	<section class="members_goodspic">
		<ul>
			{foreach name="class.goods_list" item="goods" key = "k"}
			{if condition="$k<4" }
			<li class="gooditem">
				<div class="img"">
					<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"><img class="lazy" src="__UPLOAD__/{$goods.picture_info.pic_cover_small}" ></a>
				</div>
				<div class="info">
					<p class="goods-title"><a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}">{$goods.goods_info.goods_name}</a></p>
					<p class="goods-price"><em>￥{$goods.goods_info.promotion_price}</em></p>
					<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"></a>
				</div>
			</li>
			{/if}
			{/foreach}
		</ul>
	</section>
	{/if}
{/foreach}

{foreach name="class_list" item="class"}
	{if $class.class_name=='商城热卖'}
	
<!-- 	<div class="slick">
		<a href="APP_MAIN">
			<img src="__TEMP__/{$style}/public/images/guanggao_cs_02.jpg" alt="">
		</a>
	</div> -->
	<div class="slick">
		<a href="{$hot_selling_adv['adv_list'][0]['adv_url']}">
			<img src="__UPLOAD__/{$hot_selling_adv['adv_list'][0]['adv_image']}" >
		<!-- style="height:{$discount_adv.ap_height}px;" -->
		</a>
	</div>
	
	
	<div class="controltype">
		<!-- <img src="__TEMP__/{$style}/public/images/shophot.png"/> -->
		<!-- <span class="control_l_content" style="color:red;">{$class.class_name}</span> -->
		<img src="__TEMP__/{$style}/public/images/navimg/hot_commodity.png">
	</div>
	<section class="members_goodspic">
		<ul>
			{foreach name="class.goods_list" item="goods" key = "k"}
			{if condition="$k<4" }
			<li class="gooditem">
				<div class="img">
					<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"><img class="lazy" src="__UPLOAD__/{$goods.picture_info.pic_cover_small}"></a>
				</div>
				<div class="info">
					<p class="goods-title"><a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}">{$goods.goods_info.goods_name}</a></p>
					<p class="goods-price"><em>￥{$goods.goods_info.promotion_price}</em></p>
					<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"></a>
				</div>
			</li>
			{/if}
			{/foreach}
		</ul>
	</section>
	{/if}
{/foreach}

{foreach name="class_list" item="class"}
	{if $class.class_name=='商城推荐'}
	<div class="controltype">
	<!-- <img src="__TEMP__/{$style}/public/images/shoprec.png"/> -->
	<!-- <span class="control_l_content" style="color:red;">{$class.class_name}</span> -->
	<img src="__TEMP__/{$style}/public/images/navimg/mall_recommend.png">
	</div>
	<section class="members_goodspic">
		<ul>
			{foreach name="class.goods_list" item="goods" key = "k"}
			{if condition="$k<4" }
			<li class="gooditem">
				<div class="img">
					<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"><img class="lazy" src="__UPLOAD__/{$goods.picture_info.pic_cover_small}"></a>
				</div>
				<div class="info">
					<p class="goods-title"><a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}">{$goods.goods_info.goods_name}</a></p>
					<p class="goods-price"><em>￥{$goods.goods_info.promotion_price}</em></p>
					<a href="APP_MAIN/Goods/goodsDetail.html?id={$goods.goods_info.goods_id}"></a>
				</div>
			</li>
			{/if}
			{/foreach}
		</ul>
	</section>
	{/if}
{/foreach}
<!-- 促销模块 -->
<!-- {foreach name="class_list" item="class"}
	<div class="controltype" style="background-image:url(__TEMP__/{$style}/public/images/newproduct.png);background-repeat:no-repeat;height:50px;margin:0;width:100%">
		<hr />
		<span class="control_l_content">{$class.class_name}</span>
	</div>
	<div class="slick">
		<div><a href="APP_MAIN"><img src="__TEMP__/{$style}/public/images/guanggao_cs_02.jpg" alt=""></a></div>
	</div>
	<section class="members_goodspic">
		<ul>
			{foreach name="class.goods_list" item="goods" key = "k"}
			{if condition="$k<4" }
			<li class="gooditem">
				<div class="img">
					<a href="APP_MAIN/Goods/goodsDetail?id={$goods.goods_info.goods_id}"><img class="lazy" src="__UPLOAD__/{$goods.picture_info.pic_cover_small}"></a>
				</div>
				<div class="info">
					<p class="goods-title"><a href="APP_MAIN/Goods/goodsDetail?id={$goods.goods_info.goods_id}">{$goods.goods_info.goods_name}</a></p>
					<p class="goods-price"><em>￥{$goods.goods_info.promotion_price}</em></p>
					<a href="APP_MAIN/Goods/goodsDetail?id={$goods.goods_info.goods_id}"><div class="goods-buy"></div></a>
				</div>
			</li>
			{/if}
			{/foreach}
		</ul>
	</section>
{/foreach} -->
	<div class="h60"></div>
</div>
{/block}
 {block name="javascript"}
 <script>
$(function(){
	//关注微信公众号弹出
	$("#subscribe").click(function(){
		
		$(".shade").show();
		$(".popup").show();
	})
	//关注微信公众号关闭
	$("#close").click(function(){
		$(".shade").hide();
		$(".popup").hide();
		
	})
	
	
	$.ajax({
		type:"post",
		url : "APP_MAIN/member/getShareContents",
		success : function(data){
			//alert(JSON.stringify(data));
			//document.write(data.share_img);
			/* $("#share_title").val(data['share_title']);
			$("#share_desc").val(data['share_contents']);
			$("#share_url").val(data['share_url']);
			$("#share_img_url").val(data['share_img']);\ */
			wx.config({
				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
				appId: $("#appId").val(), // 必填，公众号的唯一标识
				timestamp: $("#jsTimesTamp").val(), // 必填，生成签名的时间戳
				nonceStr:  $("#jsNonceStr").val(), // 必填，生成签名的随机串
				signature: $("#jsSignature").val(),// 必填，签名，见附录1
				jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
			});
			wx.ready(function () {
				var title = data['share_title'];
				var share_contents = data['share_contents']+'\r\n';
				var share_nick_name = data['share_nick_name']+'\r\n';
				var desc2 = share_contents+ share_nick_name + "收藏热度：★★★★★";
				var url = data['share_url'];
				var img_url = data['share_img'];
				wx.onMenuShareAppMessage({
					title: title,
					desc: desc2,
					link: url,
					imgUrl: img_url,
					trigger: function (res) {
						//alert('用户点击发送给朋友');
					},
					success: function (res) {
						//alert('已分享');
						$.ajax({
							type : "post",
							url : "APP_MAIN/index/shareGivePoint",
							data : {
								"share" : true
							},
							success : function(data){
								
							}
						})
					},
					cancel: function (res) {
						//alert('已取消');
					},
					fail: function (res) {
						//alert(JSON.stringify(res));
					}
				});
				// 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
				wx.onMenuShareTimeline({
					title: title,
					link: url,
					imgUrl: img_url,
					trigger: function (res) {
					  // alert('用户点击分享到朋友圈');
					},
					success: function (res) {
					//alert('已分享');
						$.ajax({
							type : "post",
							url : "APP_MAIN/index/shareGivePoint",
							data : {
								"share" : true
							},
							success : function(data){
								
							}
						})
					},
					cancel: function (res) {
					//alert('已取消');
					},
					fail: function (res) {
					   // alert(JSON.stringify(res));
					}
				});
	
				// 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口
				wx.onMenuShareQQ({
					title: title,
					desc: desc2,
					link: url,
					imgUrl: img_url,
					trigger: function (res) {
					//alert('用户点击分享到QQ');
					},
					complete: function (res) {
					//alert(JSON.stringify(res));
					},
					success: function (res) {
					//alert('已分享');
						$.ajax({
							type : "post",
							url : "APP_MAIN/index/shareGivePoint",
							data : {
								"share" : true
							},
							success : function(data){
								
							}
						})
					},
					cancel: function (res) {
					//alert('已取消');
					},
					fail: function (res) {
					//alert(JSON.stringify(res));
					}
				});
	
				// 2.4 监听“分享到微博”按钮点击、自定义分享内容及分享结果接口
				wx.onMenuShareWeibo({
					title: title,
					desc: desc2,
					link: url,
					imgUrl: img_url,
					trigger: function (res) {
					//alert('用户点击分享到微博');
					},
					complete: function (res) {
					//alert(JSON.stringify(res));
					},
					success: function (res) {
					//alert('已分享');
						$.ajax({
							type : "post",
							url : "APP_MAIN/index/shareGivePoint",
							data : {
								"share" : true
							},
							success : function(data){
								
							}
						})
					},
					cancel: function (res) {
					//alert('已取消');
					},
					fail: function (res) {
					//alert(JSON.stringify(res));
					}
				});
			})
		}
	})
})
</script>
{/block}